package com.zh.api.controller.behavior;

import com.zh.behavior.domain.SignsDetectDO;
import com.zh.behavior.service.SignsDetectService;
import com.zh.common.base.BaseController;
import com.zh.common.utils.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;




import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by caogang on 2019/5/29.
 */
@Controller
@RequestMapping("/signsDetect")
@Api("体征检测")
public class SignsDetectController  {

     @Autowired
     private SignsDetectService signsDetectService;


                /*
                 *
                 * 查询老人最新一条设备数据
                 *
                 * 网关：gatewayId
                 * 设备ID：equipmentId
                 *
                 * */
                @ResponseBody
                @PostMapping("/getSignsDetect")
                @ApiOperation("获取血压体温")
                public ResultVO getSignsDetect(@RequestParam Map<String, Object> params) {

                        Map map=new HashMap();
                        try {
                            SignsDetectDO signsDetectDo = signsDetectService.getNewByDev(params);
                            map.put("data",signsDetectDo);
                            return ResultVO.success(map);
                        } catch (Exception e) {
                            return ResultVO.error();
                        }
                    }




                 /*
                  *
                  * 查询老人一段时间设备数据
                  *
                  * 网关：gatewayId
                  * 设备ID：equipmentId
                  *
                  * */
                @ResponseBody
                @RequestMapping("/getNewByDevHis")
                public ResultVO  getNewByDevHis(@RequestParam Map<String, Object> params){
                    Map map=new HashMap();
                    try {
                        List<SignsDetectDO> alll = signsDetectService.getNewByDevHis(params);
                        map.put("data",alll);
                        return ResultVO.success(map);
                    } catch (Exception e) {
                        return ResultVO.error();
                    }
                }





}





